package com.boot.ch5;

import com.boot.ch5.condition.MacCondition;
import com.boot.ch5.condition.WindowsCondition;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

/**
 * @author onlyone
 */

@Configuration
public class ConditionConifg {

    @Bean
    @Conditional(WindowsCondition.class)
    public OsService windowsOsService() {
        System.out.println("-------- WindowsOsService 初始化成功");
        return new WindowsOsService();
    }

    @Bean
    @Conditional(MacCondition.class)
    public OsService macOsService() {
        System.out.println("-------- MacOsService 初始化成功");
        return new MacOsService();
    }
}
